package leetcode.lcp.lcp20230422;

import java.util.HashSet;
import java.util.Set;

//Solution2Test
public class Solution2 {

	public int adventureCamp(String[] expeditions) {
		String[] a = expeditions[0].split("->");
		Set<String> set = new HashSet<>();
		set.add("");
		for (String i : a) {
			set.add(i);
		}
		int ans = -1, max = 0;
		for (int i = 1; i < expeditions.length; i++) {
			String str = expeditions[i];
			String[] b = str.split("->");
			int cnt = 0;
			for (String n : b) {
				if (set.add(n)) {
					cnt++;
				}
			}
			if (cnt > max) {
				max = cnt;
				ans = i;
			}

		}
		return ans;
	}

}
